package org.zhouhe.vo;

import java.sql.Timestamp;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.OrderBy;

import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Article entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "article", catalog = "zpd0t1_db")
public class Article implements java.io.Serializable {

	// Fields

	private static final long serialVersionUID = 9132571479280173706L;
	private Integer articleId;
	private User user;
	private String title;
	private String keywords;
	private String quoteFrom;
	private String imgName;
	private String summary;
	private String content;
	private Integer recommended;
	private String recommendTips;
	private Integer firstPosition;
	private Integer recoIndex;
	private Timestamp displayTime;
	private Timestamp createTime;
	private Timestamp updateTime;
	private Integer status;
	private Set<ArticleReport> articleReports = new HashSet<ArticleReport>(0);
	private Set<ArticleIndustry> articleIndustries = new HashSet<ArticleIndustry>(0);
	private Set<ArticleArticleType> articleArticleTypes = new HashSet<ArticleArticleType>(0);
	private Set<ArticleReco> articleRecos = new HashSet<ArticleReco>(0);

	// Constructors

	/** default constructor */
	public Article() {
	}

	/** full constructor */
	public Article(User user, String title, String keywords, String quoteFrom, String imgName, String summary, String content, Integer recommended,
			String recommendTips, String recommendPosition, Integer firstPosition, Integer recoIndex, Timestamp displayTime, Timestamp createTime,
			Timestamp updateTime, Integer status, Set<ArticleReport> articleReports, Set<ArticleIndustry> articleIndustries,
			Set<ArticleArticleType> articleArticleTypes, Set<ArticleReco> articleRecos) {
		this.user = user;
		this.title = title;
		this.keywords = keywords;
		this.quoteFrom = quoteFrom;
		this.imgName = imgName;
		this.summary = summary;
		this.content = content;
		this.recommended = recommended;
		this.recommendTips = recommendTips;
		this.firstPosition = firstPosition;
		this.recoIndex = recoIndex;
		this.displayTime = displayTime;
		this.createTime = createTime;
		this.updateTime = updateTime;
		this.status = status;
		this.articleReports = articleReports;
		this.articleIndustries = articleIndustries;
		this.articleArticleTypes = articleArticleTypes;
		this.articleRecos = articleRecos;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "article_id", unique = true, nullable = false)
	public Integer getArticleId() {
		return this.articleId;
	}

	public void setArticleId(Integer articleId) {
		this.articleId = articleId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "user_id")
	public User getUser() {
		return this.user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	@Column(name = "title", length = 128)
	public String getTitle() {
		return this.title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	@Column(name = "keywords", length = 256)
	public String getKeywords() {
		return this.keywords;
	}

	public void setKeywords(String keywords) {
		this.keywords = keywords;
	}

	@Column(name = "quote_from", length = 128)
	public String getQuoteFrom() {
		return this.quoteFrom;
	}

	public void setQuoteFrom(String quoteFrom) {
		this.quoteFrom = quoteFrom;
	}

	@Column(name = "img_name", length = 256)
	public String getImgName() {
		return this.imgName;
	}

	public void setImgName(String imgName) {
		this.imgName = imgName;
	}

	@Column(name = "summary", length = 65535)
	public String getSummary() {
		return this.summary;
	}

	public void setSummary(String summary) {
		this.summary = summary;
	}

	@Column(name = "content", length = 65535)
	public String getContent() {
		return this.content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	@Column(name = "recommended")
	public Integer getRecommended() {
		return this.recommended;
	}

	public void setRecommended(Integer recommended) {
		this.recommended = recommended;
	}

	@Column(name = "recommend_tips", length = 65535)
	public String getRecommendTips() {
		return this.recommendTips;
	}

	public void setRecommendTips(String recommendTips) {
		this.recommendTips = recommendTips;
	}

	@Column(name = "first_position")
	public Integer getFirstPosition() {
		return this.firstPosition;
	}

	public void setFirstPosition(Integer firstPosition) {
		this.firstPosition = firstPosition;
	}

	@Column(name = "reco_index")
	public Integer getRecoIndex() {
		return this.recoIndex;
	}

	public void setRecoIndex(Integer recoIndex) {
		this.recoIndex = recoIndex;
	}

	@Column(name = "display_time", length = 19)
	public Timestamp getDisplayTime() {
		return this.displayTime;
	}

	public void setDisplayTime(Timestamp displayTime) {
		this.displayTime = displayTime;
	}

	@Column(name = "create_time", length = 19)
	public Timestamp getCreateTime() {
		return this.createTime;
	}

	public void setCreateTime(Timestamp createTime) {
		this.createTime = createTime;
	}

	@Column(name = "update_time", length = 19)
	public Timestamp getUpdateTime() {
		return this.updateTime;
	}

	public void setUpdateTime(Timestamp updateTime) {
		this.updateTime = updateTime;
	}

	@Column(name = "status")
	public Integer getStatus() {
		return this.status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "article")
	@OrderBy("articleReportId")
	public Set<ArticleReport> getArticleReports() {
		return this.articleReports;
	}

	public void setArticleReports(Set<ArticleReport> articleReports) {
		this.articleReports = articleReports;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "article")
	@OrderBy("articleIndustryId")
	public Set<ArticleIndustry> getArticleIndustries() {
		return this.articleIndustries;
	}

	public void setArticleIndustries(Set<ArticleIndustry> articleIndustries) {
		this.articleIndustries = articleIndustries;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "article")
	@OrderBy("articleArticleTypeId")
	public Set<ArticleArticleType> getArticleArticleTypes() {
		return this.articleArticleTypes;
	}

	public void setArticleArticleTypes(Set<ArticleArticleType> articleArticleTypes) {
		this.articleArticleTypes = articleArticleTypes;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "article")
	public Set<ArticleReco> getArticleRecos() {
		return this.articleRecos;
	}

	public void setArticleRecos(Set<ArticleReco> articleRecos) {
		this.articleRecos = articleRecos;
	}

}